package prueba1grails



import javax.validation.constraints.AssertTrue;

import grails.test.mixin.*

import org.junit.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(Todo)
class TodoTests extends GroovyTestCase {


	void setUp() {
		Todo.list()*.delete()
	}

	void testPersist() {
		new Todo(name: "1", createdDate:new Date(), priority: "", status:"").save()
		new Todo(name: "2", createdDate:new Date(), priority: "", status:"").save()
		new Todo(name: "3", createdDate:new Date(), priority: "", status:"").save()
		new Todo(name: "4", createdDate:new Date(), priority: "", status:"").save()
		new Todo(name: "5", createdDate:new Date(), priority: "", status:"").save()

		assert 5 == Todo.count()

		assert 5 == Todo.count()
		def actualTodo = Todo.findByName('1')
		assert actualTodo
		assert '1' == actualTodo.name
	}

	void testToString() {
		def todo1 = new Todo(name: "Pickup laundry")
		todo1.save()
		assertToString(todo1, "Pickup laundry")
	}
}
